<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
      .chatr{
        width: 500px;
        height: 500px;
      }
    </style>
</head>
<body>
    <div class="chatr">  </div>

    <script src="./echart.js"></script>
    <script>
      const data = [
            {
                name: '海门',
                value: 9
            },
            {
                name: '鄂尔多斯',
                value: 12
            },
            {
                name: '招远',
                value: 12
            },
            {
                name: '鄂尔多斯',
                value: 12
            },
            {
                name: '招远',
                value: 12
            }
        ].sort((a,b) => b.value - a.value)

        const charInstance = echarts.init(document.querySelector('.chart'));
        console.log(echarts);
         const option = {
          xAxis: {
            type: 'category',
            data: data.map(d=>d.name)
          },
          yAxis: {
            type: 'value'
          },
          series: [
            {
            data: data.map(d=>d.value),
            type: 'line'
            }
          ]
        };
            chartInstance.setOption(option)
    </script>
</body>
</html>
